From b85f0ccc672455d4b7c895cb00d3804b44310659 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 15 Apr 2015 17:44:55 +0800 Subject: [PATCH] gdk-win32: Really Implement GdkScreen->is_composited() The current GdkScreen->is_composited() is a stub as we were having Windows XP being supported, which does not support Desktop Window Manager (DWM), which is used by Windows for composition. Windows Vista and later support DWM, and it is always enabled on Windows 8/ Server 2012 and later. Please note that as we are dropping XP support in this cycle, this is the commit that would say goodbye to Windows XP support for GTK+-3.x, by linking directly to dwmapi.dll. This means, we only check whether we are on Windows 8 or Server 2012 (or later) to see whether we unconditionally have composition enabled. https://bugzilla.gnome.org/show_bug.cgi?id=741849 --- build/win32/vs10/gdk.vcxprojin | 8 ++++---- build/win32/vs9/gdk.vcprojin | 8 ++++---- configure.ac | 2 +- gdk/win32/gdkglobals-win32.c | 2 ++ gdk/win32/gdkmain-win32.c | 1 + gdk/win32/gdkprivate-win32.h | 2 ++ gdk/win32/gdkscreen-win32.c | 13 ++++++++++++- 7 files changed, 26 insertions(+), 10 deletions(-) diff --git a/build/win32/vs10/gdk.vcxprojin b/build/win32/vs10/gdk.vcxprojin index 35e14a2d1a..fff2f6da67 100644 --- a/build/win32/vs10/gdk.vcxprojin +++ b/build/win32/vs10/gdk.vcxprojin @@ -167,7 +167,7 @@ EditAndContinue - imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) + imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies) $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll true $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb @@ -209,7 +209,7 @@ ProgramDatabase - imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) + imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies) $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll true $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb @@ -257,7 +257,7 @@ ProgramDatabase - imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) + imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies) $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll true $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb @@ -299,7 +299,7 @@ ProgramDatabase - imm32.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) + imm32.lib;winmm.lib;ws2_32.lib;dwmapi.lib;%(AdditionalDependencies) $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll true $(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb diff --git a/build/win32/vs9/gdk.vcprojin b/build/win32/vs9/gdk.vcprojin index ad33f6ef96..59d17362a3 100644 --- a/build/win32/vs9/gdk.vcprojin +++ b/build/win32/vs9/gdk.vcprojin @@ -74,7 +74,7 @@ /> + struct _GdkWin32Screen { GdkScreen parent_instance; @@ -195,9 +197,18 @@ gdk_win32_screen_get_window_stack (GdkScreen *screen) static gboolean gdk_win32_screen_is_composited (GdkScreen *screen) { + gboolean is_composited; g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE); - return FALSE; + /* On Windows 8 and later, DWM (composition) is always enabled */ + if (_is_win8_or_later) + return TRUE; + else + { + if (DwmIsCompositionEnabled (&is_composited) != S_OK) + return FALSE; + return is_composited; + } } static void -- 2.30.2